<template>
  <div class="Dismain">
    <img
      class="disimg"
      src="https://s1.ax1x.com/2020/05/23/YxaLMq.jpg"
      alt=""
    />

    <div data-v-fae5bece="" class="site-content animate">
      <div data-v-fae5bece="" class="notify"></div>
      <div data-v-fae5bece="" class="top-feature">
        <h1 data-v-c3407ce0="" data-v-fae5bece="" class="section-title">
          <div
            data-v-fae5bece=""
            data-v-c3407ce0=""
            style="display: flex; align-items: flex-end"
          >
            学校新闻
            <section data-v-8a56e522="" data-v-fae5bece="" data-v-c3407ce0="">
              <div data-v-8a56e522="" class="loader loader-7">
                <div data-v-8a56e522="" class="line line1"></div>
                <div data-v-8a56e522="" class="line line2"></div>
                <div data-v-8a56e522="" class="line line3"></div>
              </div>
            </section>
          </div>
        </h1>
        <div data-v-fae5bece="" class="feature-content">
          <div data-v-fae5bece="" class="feature-item">
            <div data-v-1bfb9a16="" data-v-fae5bece="" class="feature">
              <a
                data-v-1bfb9a16=""
                href="https://www.sontan.edu.cn/SpotlightNews/info_itemid_12713.html"
                class=""
                ><div data-v-1bfb9a16="" class="feature-title">
                  <span data-v-1bfb9a16="" class="foverlay"
                    ></span
                  >
                </div>
                <img
                  data-v-1bfb9a16=""
                  src="https://www.sontan.edu.cn/uploadfiles/2021/06/20210602161320753.jpg"
              /></a>
            </div>
          </div>
          <div data-v-fae5bece="" class="feature-item">
            <div data-v-1bfb9a16="" data-v-fae5bece="" class="feature">
              <a data-v-1bfb9a16=""  class=""
                ><div data-v-1bfb9a16="" class="feature-title">
                  <span data-v-1bfb9a16="" class="foverlay"></span>
                </div>
                <img
                  data-v-1bfb9a16=""
                  src="https://www.sontan.edu.cn/uploadfiles/2021/01/20210115181703975.jpg"
              /></a>
            </div>
          </div>
          <div data-v-fae5bece="" class="feature-item">
            <div data-v-1bfb9a16="" data-v-fae5bece="" class="feature">
              <a
                data-v-1bfb9a16=""
                
                class=""
                ><div data-v-1bfb9a16="" class="feature-title">
                  <span data-v-1bfb9a16="" class="foverlay"></span>
                </div>
                <img
                  data-v-1bfb9a16=""
                  src="https://www.sontan.edu.cn/uploadfiles/2021/01/20210116201543250.jpg"
              /></a>
            </div>
          </div>
        </div>
      </div>
      <main data-v-fae5bece="" class="site-main">
        <h1 data-v-c3407ce0="" data-v-fae5bece="" class="section-title">
          讨论
        </h1>

        <article
          data-v-0148dea0=""
          data-v-fae5bece=""
          class="post post-list"
          v-for="item in articleData"
          :key="item"
        >
          <div data-v-0148dea0="" class="post-entry">
            <div data-v-0148dea0="" class="feature">
              <a data-v-0148dea0="" href="/#/discuss" class="">
                <img
                  data-v-0148dea0=""
                  src="https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2013128738,1744245349&fm=26&gp=0.jpg"
                />
              </a>
            </div>
            <h1 data-v-0148dea0="" class="entry-title">
              <a data-v-0148dea0="" href="" class="">{{ item.title }}</a>
            </h1>
            <div data-v-0148dea0="" class="p-time">
              <i data-v-0148dea0="" class="iconfont iconmeditor-time"></i>
              {{ item.time }}
            </div>
            <p data-v-0148dea0="" class="summary">
              {{ item.content }}
            </p>
            <footer data-v-0148dea0="" class="entry-footer">
              <div data-v-0148dea0="" class="post-more">
                <a data-v-0148dea0="" href="/#/discuss" class=""
                  ><i
                    data-v-0148dea0=""
                    class="iconfont iconfish-li"
                    style="font-size: 25px"
                  ></i
                ></a>
              </div>
              <div data-v-0148dea0="" class="info-meta">
              </div>
            </footer>
          </div>
          <hr data-v-0148dea0="" />
        </article>
      </main>
      <div data-v-fae5bece="" class="more" style="">
        <div data-v-fae5bece="" class="more-btn" @click="AddDiscuss">Add</div>
      </div>
    </div>

    <el-dialog width="400px" title="新增讨论" :visible="discussFormVisible">
      <el-form :model="form">
        <el-form-item label="标题">
          <el-input
            width="10px"
            v-model="form.title"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item label="内容">
          <el-input v-model="form.content" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="discussFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="onConfirm">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import GLOBAL from "@/api/global_var"
export default {
  data() {
    return {
      dialogFormVisible: true,

      formLabelWidth: "120px",
      form: {
        name: "",
        passwd: "",
      },
      discussFormVisible: false,
      articleData: [
        {
          title: "少玩手机，多读书",
          time: "2021-06-11 07:12",
          content:
            "读书可以让人摒弃物欲世界的思考，也引人对内心世界追求的思考，更甚是知识到智慧的进阶",
          comment: 23,
          hot: 201,
        },
      ],
    };
  },
  methods: {
    formatDate(params) {
      let date = params;
      let formatStr = "yyyy-MM-dd  HH:mm";
      // 传入日期字符串 - 转成时间戳 - 转成标准时间
      let timeStamp = params.getTime();
      console.log(timeStamp);
      date = new Date(timeStamp);
      formatStr = formatStr.replace(
        new RegExp("yyyy"),
        `${date.getFullYear()}`
      );
      const month = date.getMonth() + 1;
      formatStr = formatStr.replace(
        new RegExp("MM"),
        `${month > 9 ? month : "0" + month}`
      );
      const day = date.getDate();
      formatStr = formatStr.replace(
        new RegExp("dd"),
        `${day > 9 ? day : "0" + day}`
      );
      const hour = date.getHours();
      formatStr = formatStr.replace(
        new RegExp("HH"),
        `${hour > 9 ? hour : "0" + hour}`
      );
      const min = date.getMinutes();
      formatStr = formatStr.replace(
        new RegExp("mm"),
        `${min > 9 ? min : "0" + min}`
      );
      const sec = date.getSeconds();
      formatStr = formatStr.replace(
        new RegExp("ss"),
        `${sec > 9 ? sec : "0" + sec}`
      );
      return formatStr;
    },
    AddDiscuss() {
      console.log("addbtn");
      this.discussFormVisible = true;
    },
    onConfirm() {
      console.log(this.discussFormVisible);
      this.articleData.unshift({title:this.form.title,content:this.form.content,time:this.formatDate(new Date())})
      this.discussFormVisible = false;
      GLOBAL.discuss=GLOBAL.discuss+1
      //console.log(this.$discuss)
    },
  },
};
</script>
<style scoped>
.disimg {
  display: inline-block;
  border: none;
  width: 100%;
  height: 200px;
  border-radius: 5px;
}
.animate {
  -webkit-animation: main 1.5s;
  animation: main 1.5s;
}
.site-content {
  margin: 0 auto;
  padding: 0 10px;
  max-width: 800px;
}
.top-feature[data-v-fae5bece] {
  width: 100%;
  height: auto;
  margin-top: 30px;
}
.loader[data-v-8a56e522] {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin: 0 10px;
  display: inline-block;
  vertical-align: middle;
}
.loader-7 .line1[data-v-8a56e522] {
  left: 0;
  -webkit-animation: line-grow-data-v-8a56e522 0.5s ease alternate infinite;
  animation: line-grow-data-v-8a56e522 0.5s ease alternate infinite;
}
.loader-7 .line2[data-v-8a56e522] {
  left: 7px;
  -webkit-animation: line-grow-data-v-8a56e522 0.5s 0.2s ease alternate infinite;
  animation: line-grow-data-v-8a56e522 0.5s 0.2s ease alternate infinite;
}
.loader-7 .line3[data-v-8a56e522] {
  left: 14px;
  -webkit-animation: line-grow-data-v-8a56e522 0.5s 0.4s ease alternate infinite;
  animation: line-grow-data-v-8a56e522 0.5s 0.4s ease alternate infinite;
}
.loader-7 .line[data-v-8a56e522] {
  width: 3px;
  position: absolute;
  border-radius: 2px;
  bottom: 0;
  background: linear-gradient(to bottom, #1ee95d, #5714ce);
}
.top-feature .feature-content[data-v-fae5bece] {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  position: relative;
}
.top-feature .feature-content .feature-item[data-v-fae5bece] {
  width: 32.9%;
}
.feature[data-v-1bfb9a16] {
  width: inherit;
  position: relative;
}
a,
a:link,
a:visited,
a:hover,
a:active {
  text-decoration: none;
  color: unset;
}
.feature img[data-v-1bfb9a16] {
  height: 160px;
  width: 257px;
  -o-object-fit: cover;
  object-fit: cover;
  border-radius: 5px;
}
.feature .foverlay[data-v-1bfb9a16] {
  position: absolute;
  z-index: 2;
  width: 257px;
  height: 160px;
  text-align: center;
  line-height: 160px;
  background: #bbe2db;
  color: white;
  font-size: 16px;
  opacity: 0;
  border-radius: 5px;
  transition: opacity 0.4s ease-out;
}
.site-main[data-v-fae5bece] {
  padding-top: 80px;
}
h1.section-title[data-v-c3407ce0] {
  color: #757575;
  font-size: 16px;
  font-weight: 400;
  padding-bottom: 15px;
  border-bottom: 1px dashed #ececec;
}
.post[data-v-0148dea0] {
  margin: 0 0 4% 0;
  position: relative;
}

.post-entry .feature[data-v-0148dea0] {
  position: absolute;
  margin-top: 10px;
}
.post-entry .feature img[data-v-0148dea0]:hover {
  transform: scale(1.1, 1.1);
  -webkit-filter: contrast(130%);
  filter: contrast(130%);
}
.post-entry .feature img[data-v-0148dea0] {
  width: 100px;
  height: 100px;
  -o-object-fit: cover;
  object-fit: cover;
  border-radius: 50%;
  padding: 2px;
  border: 1px solid #dadada;
  position: relative;
  transition: all 0.2s linear;
  overflow: hidden;
}
.post-entry .entry-title[data-v-0148dea0] {
  font-size: 21px;
  font-weight: 600;
  line-height: 50px;
  margin: 0 0 0 17%;
  position: relative;
  z-index: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 70%;
  color: #737373;
}
.post-entry .p-time[data-v-0148dea0] {
  position: absolute;
  right: 0;
  top: 16px;
  font-size: 12px;
  color: #989898;
  letter-spacing: 1px;
  font-family: din, "Hiragino Sans GB", "Microsoft Yahei", Arial, sans-serif;
  display: flex;
  align-items: center;
}
.post-entry p.summary[data-v-0148dea0] {
  min-height: 60px;
  margin: 0 0 0 17%;
  font-size: 15px;
  color: #6f6f6f;
  letter-spacing: 1px;
  line-height: 30px;
}
.post-entry footer.entry-footer[data-v-0148dea0] {
  margin: 0 0 0 17%;
  list-style: none;
}
.post-entry footer.entry-footer .post-more[data-v-0148dea0] {
  margin-top: 10px;
  text-align: right;
  color: #a0dad0;
}
.post-entry:hover footer.entry-footer .info-meta[data-v-0148dea0] {
  transform: translate3d(-230px, 0, 0);
  opacity: 1;
  visibility: visible;
}
.post-entry footer.entry-footer .info-meta[data-v-0148dea0] {
  margin-top: 10px;
  font-family: din, "Hiragino Sans GB", "Microsoft Yahei", Arial, sans-serif;
  position: absolute;
  top: 20px;
  opacity: 0;
  padding-top: 8px;
  border-top: 1px solid #ddd;
  transform: translate3d(-150px, 0, 0);
  visibility: hidden;
  transition: 0.7s all ease;
  -webkit-transition: 0.6s all ease;
  -moz-transition: 0.6s all linear;
  -o-transition: 0.6s all ease;
  -ms-transition: 0.6s all ease;
}
.post-entry footer.entry-footer .comnum[data-v-0148dea0] {
  float: left;
}
.post-entry footer.entry-footer .info-meta span[data-v-0148dea0],
.post-entry footer.entry-footer .info-meta a[data-v-0148dea0] {
  color: #b3b3b3;
  font-size: 12px;
}
.post-entry footer.entry-footer .info-meta a[data-v-0148dea0] {
  color: #b3b3b3;
  font-size: 12px;
}
.post hr[data-v-0148dea0] {
  width: 30%;
  height: 1px;
  margin: 0 auto;
  border: 0;
  background: #efefef;
}
.more[data-v-fae5bece] {
  margin: 50px 0;
}
.more .more-btn[data-v-fae5bece]:hover {
  color: #8fd0cc;
  border: 1px dashed #8fd0cc;
}
.more .more-btn[data-v-fae5bece] {
  width: 100px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  color: #adadad;
  border: 1px solid #adadad;
  border-radius: 20px;
  margin: 0 auto;
  cursor: pointer;
}
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
</style>